package cn.wolfcode.trip.app.web.controller;

import cn.wolfcode.trip.app.util.UserContext;
import cn.wolfcode.trip.base.service.IDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("/dailys")
public class DailyController {

    @Autowired
    private IDailyService dailyService;
    @PostMapping
    public Object collect(Long dailyID){
        //获取user的id
        Long userId = UserContext.getCurrentUser().getId();
        String collect=dailyService.collect(dailyID,userId);
        HashMap<String, Object> map = new HashMap<>();
        map.put("collect",collect);
        return map;
    }

}
